package com.ruoyi.rural.service.impl;

import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.rural.domain.RuralVaccination;
import com.ruoyi.rural.domain.VaccinationData;
import com.ruoyi.rural.mapper.RuralVaccinationMapper;
import com.ruoyi.rural.service.IRuralVaccinationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 疫苗接种信息Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-06
 */
@Service
public class RuralVaccinationServiceImpl implements IRuralVaccinationService 
{
    @Autowired
    private RuralVaccinationMapper ruralVaccinationMapper;

    /**
     * 查询疫苗接种信息
     * 
     * @param id 疫苗接种信息主键
     * @return 疫苗接种信息
     */
    @Override
    public RuralVaccination selectRuralVaccinationById(String id)
    {
        return ruralVaccinationMapper.selectRuralVaccinationById(id);
    }

    /**
     * 查询疫苗接种信息列表
     * 
     * @param ruralVaccination 疫苗接种信息
     * @return 疫苗接种信息
     */
    @Override
    public List<RuralVaccination> selectRuralVaccinationList(RuralVaccination ruralVaccination)
    {
        return ruralVaccinationMapper.selectRuralVaccinationList(ruralVaccination);
    }

    /**
     * 新增疫苗接种信息
     * 
     * @param ruralVaccination 疫苗接种信息
     * @return 结果
     */
    @Override
    public int insertRuralVaccination(RuralVaccination ruralVaccination)
    {
        ruralVaccination.setId(UUID.randomUUID().toString());
        ruralVaccination.setCreateTime(DateUtils.getNowDate());
        return ruralVaccinationMapper.insertRuralVaccination(ruralVaccination);
    }

    /**
     * 修改疫苗接种信息
     * 
     * @param ruralVaccination 疫苗接种信息
     * @return 结果
     */
    @Override
    public int updateRuralVaccination(RuralVaccination ruralVaccination)
    {
        ruralVaccination.setUpdateTime(DateUtils.getNowDate());
        return ruralVaccinationMapper.updateRuralVaccination(ruralVaccination);
    }

    /**
     * 批量删除疫苗接种信息
     * 
     * @param ids 需要删除的疫苗接种信息主键
     * @return 结果
     */
    @Override
    public int deleteRuralVaccinationByIds(String[] ids)
    {
        return ruralVaccinationMapper.deleteRuralVaccinationByIds(ids);
    }

    /**
     * 删除疫苗接种信息信息
     * 
     * @param id 疫苗接种信息主键
     * @return 结果
     */
    @Override
    public int deleteRuralVaccinationById(String id)
    {
        return ruralVaccinationMapper.deleteRuralVaccinationById(id);
    }

    @Override
    public List<VaccinationData> selectRuralVaccinationListByCompleted() {
        return ruralVaccinationMapper.selectRuralVaccinationListByCompleted();
    }

}
